﻿/*----------------------------------------------------------------------------------------
*
*  Copyright 2019, Gao Hai Hui, <fromzeropoint@126.com>.  All rights reserved.
*  https://gitee.com/helloworldghh/xoskit.git
*  Use of this source code is governed by a MIT license
*  that can be found in the License file.
*
----------------------------------------------------------------------------------------*/
#ifndef __B276F9E3_DB5D_4e9a_850C_D968765095FB__
#define __B276F9E3_DB5D_4e9a_850C_D968765095FB__

#include "../macro/head.h"
#include "../release/head.h"

/////////////////////////////////////////////////////////////////////////////////////////
// 
namespace xos
{
    // 
    // time interface
    // 
    class i_time : public i_release
    {
    public:
        virtual ~i_time(){}

    public:
        // 
        // Wed, 28 Aug 2019 03:48:08 GMT
        // 2018-01-30 05:05:30
        // 2018-01-30
        // 
		virtual int get_time_string_ymdhms( char * lpszTimeStr, int nSize, int * lpnRetLen ) = 0;
		virtual int get_time_string_ymd( char * lpszTimeStr, int nSize, int * lpnRetLen ) = 0;
		virtual int get_time_string_hms( char * lpszTimeStr, int nSize, int * lpnRetLen ) = 0;
        virtual int get_time_string_gmt( char * lpszTimeStr, int nSize, int * lpnRetLen ) = 0;
        virtual int get_time_name_ymdhms( char * lpszTimeStr, int nSize, int * lpnRetLen ) = 0;
        virtual int get_time_name_ymd( char * lpszTimeStr, int nSize, int * lpnRetLen ) = 0;
        virtual int get_time_name_hms( char * lpszTimeStr, int nSize, int * lpnRetLen ) = 0;
		virtual xos_i64 get_wall_time_s() = 0;
		virtual int get_milli_second() = 0;
		virtual int get_year() = 0;
		virtual int get_month() = 0;
		virtual int get_week() = 0;
		virtual int get_day() = 0;
		virtual int get_hour() = 0;
		virtual int get_minute() = 0;
		virtual int get_second() = 0;
		virtual int get_time() = 0;

        // 
        // Wed, 28 Aug 2019 03:48:08 GMT
        // 2018-01-30 05:05:30
        // 2018-01-30
        // 
		virtual int set_time_string_ymdhms( const char * lpszTimeStr ) = 0;
		virtual int set_time_string_ymd( const char * lpszTimeStr ) = 0;
        virtual int set_time_string_gmt( const char * lpszTimeStr ) = 0;
        virtual int set_time_name_ymdhms( const char * lpszTimeStr ) = 0;
        virtual int set_time_name_ymd( const char * lpszTimeStr ) = 0;
        virtual int set_wall_time_s( xos_i64 tm_s ) = 0;
        virtual int set_milli_second( int tm_ms ) = 0;
        virtual int set_year( int tm_y ) = 0;
        virtual int set_month( int tm_m ) = 0;
        virtual int set_day( int tm_d ) = 0;
        virtual int set_hour( int tm_h ) = 0;
        virtual int set_minute( int tm_m ) = 0;
        virtual int set_second( int tm_s ) = 0;

		// 
		// calculate time difference. unit : 1 / 1000 second
		// 
		virtual int diffrent( i_time * pLastTime, xos_i64 * lpulDif ) = 0;
    };
}

#endif // __B276F9E3_DB5D_4e9a_850C_D968765095FB__
